package com.aooci.ordercat.jsf;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import javax.faces.event.ActionEvent;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;

import com.aooci.ordercat.domain.Takeaway;
import com.aooci.ordercat.service.DashboardService;

//@ManagedBean
@RequestScoped
@Component
public class TakeawayController implements Serializable{

	private static final long serialVersionUID = -2625685756120786130L;

	private static final Logger log = Logger.getLogger(TakeawayController.class);
	

	
	public static final int DEFAULT_NUMBER_OF_CLIENT_FOR_DINING_TABLE = 2;
	
	@Autowired
	@Qualifier("dashboardService")
	private transient DashboardService dashboardService;
	
	private Takeaway newTakeaway;
	private Date takingTime;
	/*
	public void creatNewTakeawayListener(ActionEvent event) {
		this.newTakeaway = this.dashboardService.loadOneFreeTakeaway();
		this.takingTime = new Date(new Date().getTime() + (DEFAULT_ADDING_TAKING_MINUTES * ONE_MINUTE_IN_MILLIS));;
	}
	*/
	public List<Takeaway> getNoFreeTakeaways(){
		return this.dashboardService.loadNoFreeTakeaways();
	}

	/**
	 * @return the newTakeaway
	 */
	public Takeaway getNewTakeaway() {
		return newTakeaway;
	}

	/**
	 * @param newTakeaway the newTakeaway to set
	 */
	public void setNewTakeaway(Takeaway newTakeaway) {
		this.newTakeaway = newTakeaway;
	}

	/**
	 * @return the takingTime
	 */
	public Date getTakingTime() {
		return takingTime;
	}

	/**
	 * @param takingTime the takingTime to set
	 */
	public void setTakingTime(Date takingTime) {
		this.takingTime = takingTime;
	}
}
